package step_three;

public class kuaiSu {
    public static void main(String[] args) {
        //        插入排序
        int query[] = {1, 5, 6, 2, 0, 14, 52, 32, 98};

        test(query, 0, query.length - 1);

        for (int i = 0; i < query.length; i++) {
            System.out.print(query[i] + " ");
        }
    }

    public static void test(int[] query, int start, int end) {
        if (start >= end) return;

        int key = query[start], left = start, right = end;
        while (left < right) {
            while (query[right] >= key && left < right) right--;
            query[left] = query[right];
            while (query[left] <= key && left < right) left++;
            query[right] = query[left];
        }
        query[left] = key;
        test(query, start, right - 1);
        test(query, right + 1, end);

    }
}
